#ifndef AVIATION_CUSTOMER_H
#define AVIATION_CUSTOMER_H

#include "util.h"

#include <string>

#include <boost/serialization/nvp.hpp>

namespace aviation
{

/// This class represents a customer by their customer details.
class Customer
{
public:

	typedef std::string String;

	// Constructors

	//Initialises customer details.
	Customer();

	/// Creates a customer from strings representing the customers details.
	/// \param title The customer's title.
	/// \param firstName The customer's given name.
	/// \param lastName The customer's surname.
	/// \param address The customer's address.
	/// \param passportNumber The customer's passport number.
	/// \param teleNumber The customer's telephone number.
	Customer(String title, String firstName, String lastName, String address, String passportNumber, String teleNumber);
	
	/// Copies the customer from another.
	Customer(const Customer& other);

	/// Destructs the customer.
	~Customer();

	/// Serialization (file I-O) function.
	/// \param ar A boost::archive formatter type.
	/// \param version The file version.
	template <class Archive>
	void serialize(Archive& ar, const unsigned int version);

	// Operators

	/// Assigns the details of one customer to another.
	Customer& operator=(const Customer& other);

	/// Tests for equality between two customers.
	/// \returns True if the customers are the same, or false if they are different
	const bool operator==(const Customer& other) const;

	/// Tests for inequality between two customers.
	/// \returns True if the customers are different, or false if they are the same.
	const bool operator!=(const Customer& other) const;

	/// Tests for weak ordering between two customers.
	/// \returns True if one customer is strictly less than another.
	const bool operator<(const Customer& other) const;

	// Accessors

	/// Gets the customers title as a string.
	const String GetTitle() const;

	/// Gets the customers first name as a string.
	const String GetFirstName() const;
	
	/// Gets the customers last name as a string.
	const String GetLastName() const;

	/// Gets the customers address as a string.
	const String GetAddress() const;

	/// Gets the customers passport number as a string.
	const String GetPassportNumber() const;
	
	/// Gets the customers phone number as a string.
	const String GetTelephoneNumber() const;

	/// Gets the customers unique ID.
	const unsigned GetID() const;

	/// Returns all the customers details as a string.
	const String AsString() const;

private:

	String m_title;
	String m_firstName;
	String m_lastName;
	String m_address;
	String m_passportNumber;
	String m_teleNumber;

	unsigned m_ID;
};

template <class Archive>
void Customer::serialize(Archive& ar, const unsigned int version)
{
	ar & BOOST_SERIALIZATION_NVP(m_title);
	ar & BOOST_SERIALIZATION_NVP(m_firstName);
	ar & BOOST_SERIALIZATION_NVP(m_lastName);
	ar & BOOST_SERIALIZATION_NVP(m_address);
	ar & BOOST_SERIALIZATION_NVP(m_passportNumber);
	ar & BOOST_SERIALIZATION_NVP(m_teleNumber);
	ar & BOOST_SERIALIZATION_NVP(m_ID);
}

} // namespace aviation

#endif // AVIATION_CUSTOMER_H